import fetch from 'isomorphic-fetch';
import {BaseUrl} from "./BaseUrl";

function postFetch(fetchUrl, formData) {
    let url = BaseUrl + fetchUrl;
    fetch(url, {
        method: 'post',
        headers: {
            'Accept': 'application/json',
            'Access-Control-Allow-Origin': 'http://localhost:8071'
        },
        body: formData,
        credentials: 'include',
        redirect: 'follow',
        mode: 'cors'
    }).then(res => res.json()).then(json => {
        return json;
    }).catch(err => {
        console.log(err);
    });
}

export {postFetch}